// JavaScript Document
var project = "/admin";
// 登录页面
var login_html = project+"/html/login.html";
// 追加页面
var add_expense_apply_html = project+"/html/rexpenseApply.html";
// 待审核页面
var expense_apply_confirm_html = project+"/html/expenseApplyConfirm.html";
// 报销申请页面
var expense_apply_html = project+"/html/expenseApply.html";
// 历史申请报销页面
var expense_apply_His_html = project+"/html/expenseApplyListHis.html";
// 历史审核页面
var expense_apply_confirm_His_html = project+"/html/expenseApplyConfirmHis.html";
// 登录
var login_url = project+"/user/login";
// 用户信息
var user_info_url = project+"/user/getUserInfo";
// 报销申请初始化
var expense_apply_init_url = project+"/expenseApply/applyInfoInit";
// 报销申请确认
var expense_apply_confirm = project+"/expenseApply/saveExpenseApply";
// 待审核页面用户信息
var to_confirm_users = project+"/expenseApply/toConfirmUsers";
// 待审核报销申请数据
var to_confirm_expense_applys = project+"/expenseApply/toConfirmList";
// 确认审核报销申请
var confirm_expensy_applys = project+"/expenseApply/confirmAudit";
// 报销申请列表
var expensy_applys_list = project+"/expenseApply/confirmedList";
// 追加报销申请
var add_expensy_apply = project+"/expenseApply/addExpenseApply";
// 全部店铺列表
var store_list = project+"/store/getStores";
// 获取单个报销申请
var get_expense_apply = project+"/expenseApply/getExpenseApply";
// 报销申请历史
var expensy_applys_history = project+"/expenseApply/apply/history";
// 审核历史
var expensy_applys_confirm_history = project+"/expenseApply/confirm/history";
// 导出excel
var confirmed_expensy_applys_export = project+"/expenseApply/exportExcel";

// 之返回返回的data数据
function doAjax(url, data) {
    var result;
    $.ajax({
        type: "GET",
        url: url,
        dataType: "json",
        data: data,
        async: false,
        success: function (data) {
            if(data.code == 999){
                location.href = login_html;
            }else if(data.code == 0){
                alert(data.msg);
                result = data.data;
            }else {
                result = data.data;
            }
        }
    });
    return result;
}
// 返回原始数据
function doAjaxAll(url, data) {
    var result;
    $.ajax({
        type: "GET",
        url: url,
        dataType: "json",
        data: data,
        async: false,
        success: function (data) {
            if(data.code == 999){
                location.href = login_url;
            }else if(data.code == 0){
                alert(data.msg);
                result = data;
            }else {
                result = data;
            }
        }
    });
    return result;
}
function doAjaxOnlyUrl(url) {
    return doAjax(url, null);
}

function doAjaxAllOnlyUrl(url) {
    return doAjaxAll(url, null);
}
// 获取url里面的参数
function getQueryVariable(variable)
{
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if(pair[0] == variable){return pair[1];}
    }
    return(false);
}


























